
Partial Class BEdit
    Inherits System.Web.UI.Page
    Dim Str As String

    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        Response.Cache.SetCacheability(HttpCacheability.NoCache)
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Session("type") <> "buyer" Then
            Response.Redirect("Error.aspx")
            Exit Sub
        End If

        lnkProfName.Text = "Logged in as " & Session("prim") & " (" & Session("sec") & ")"

        If Me.IsPostBack = False Then

            'code for disable the cache
            '|||||||||||||||||||||||||||||||||||||||||||||||||||||||
            Response.Cache.SetCacheability(HttpCacheability.NoCache)
            '|||||||||||||||||||||||||||||||||||||||||||||||||||||||


            Dim b As New Globo
            b.executesql("select * from Countries", False)
            While b.dr.Read = True
                ddlCon.Items.Add(b.dr(0))
            End While
            b.dr.Close()
            Str = Session("b_id")



            Dim a As New Globo
            a.executesql("select buyer_name, buyer_address, country, contact_person, bemail from buyers where buyer_id= '" & Str & "'", False)

            If a.dr.Read = True Then
                txtFname.Text = a.dr(0)
                txtLoc.Text = a.dr(1)
                ddlCon.Text = a.dr(2)
                txtConPer.Text = a.dr(3)
                txtBEmail.Text = a.dr(4)
                a.dr.Close()
            End If
        End If
    End Sub

    Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
        'Blank Filed Validation Check
        '++++++++++++++++++++++++++++++++++++++++++
        If txtBEmail.Text = "" Then
            lblErr.Text = "Enter Email ID"
            lblErr.Visible = True
            Exit Sub
        End If

        If txtFname.Text = "" Then
            lblErr.Text = "Enter Buyer Name"
            lblErr.Visible = True
            Exit Sub
        End If

        If ddlCon.Text = "" Then
            lblErr.Text = "Select Country"
            lblErr.Visible = True
            Exit Sub
        End If

        If txtLoc.Text = "" Then
            lblErr.Text = "Enter Your Location"
            lblErr.Visible = True
            Exit Sub
        End If

        If txtConPer.Text = "" Then
            lblErr.Text = "Enter Contact Person Details"
            lblErr.Visible = True
            Exit Sub
        End If

        If txtBEmail.Text = "" Then
            lblErr.Text = "Enter Buyer Email"
            lblErr.Visible = True
            Exit Sub
        End If


        '___________________________________________

        Dim a As New Globo
        Str = Session("b_id")
        a.executesql("update buyers set buyer_name = '" & txtFname.Text & "', buyer_address= '" & txtLoc.Text & "', country= '" & ddlCon.Text & "', contact_person= '" & txtConPer.Text & "', bemail= '" & txtBEmail.Text & "' where buyer_id='" & Str & "'", True)
        '*******************************************************
        Session("bemail") = txtBEmail.Text
        Server.Transfer("BProfile.aspx")

    End Sub

    Protected Sub lnkChngPass_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkChngPass.Click
        Response.Redirect("PasswordChange.aspx")
    End Sub

    '_________________________________________________________________________________________________________________________________
    '#################################################################################################################################
    Protected Sub lnkProfName_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkProfName.Click
        Response.Redirect("BProfile.aspx")
    End Sub

    'Protected Sub lnkQuery_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkQuery.Click
    '    Response.Redirect("Query.aspx")
    'End Sub

    Protected Sub lnkThemes_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkThemes.Click
        Response.Redirect("Themes.aspx")
    End Sub

    Protected Sub lnkSettings_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkSettings.Click
        Response.Redirect("Settings.aspx")
    End Sub

    Protected Sub lnkLogOut_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkLogOut.Click
        Server.Transfer("Loading.aspx")
    End Sub

    '_____________________________________________________________________________________________________________
    '*************************************************************************************************************
    Protected Sub lnkAboutUs_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkAboutUs.Click
        Response.Redirect("AboutUs.aspx")
    End Sub

    Protected Sub lnkTermCond_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkTermCond.Click
        Response.Redirect("TermsConditions.aspx")
    End Sub

    Protected Sub lnkContactUs_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkContactUs.Click
        Response.Redirect("ContactUs.aspx")
    End Sub

    Protected Sub lnkFAQs_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkFAQs.Click
        Response.Redirect("FAQs.aspx")
    End Sub

    Protected Sub lnkFeedback_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkFeedback.Click
        Response.Redirect("Feedback.aspx")
    End Sub
End Class